package com.zryc.shop.oms.controller;

import com.zryc.shop.oms.entity.OrderSetting;
import com.zryc.shop.oms.service.IOrderSettingService;
import com.zryc.shop.util.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 * 订单设置表 前端控制器
 * </p>
 *
 * @author 王志平
 * @since 2024-10-01
 */
@RestController
@RequestMapping("/oms/orderSetting")
@Api(tags = "订单默认超时设置")
public class OrderSettingController {
    @Autowired
    private IOrderSettingService orderSettingService;

    @GetMapping("/{id}")
    @ApiOperation("查询订单超时设置")
    public ResponseResult info(@PathVariable Long id) {
        return new ResponseResult(200, "查询完成", orderSettingService.getById(id));
    }

    @PostMapping("/update/{id}")
    @ApiOperation("修改订单超时设置")
    public ResponseResult update(@PathVariable Long id, @RequestBody OrderSetting orderSetting) {
        orderSetting.setId(id);
        orderSettingService.updateById(orderSetting);
        return new ResponseResult(200, "修改成功");
    }
}
